﻿using LNet;
using OestsCommon.Model;
using OestsServer.Net;

namespace OestsServer.Handlers.UnityHandlers
{
    /*
     *  考试 参数:paperId  返回一个 paper
     */
    public class ToOESPClientHandler : HandlerBase<UnityClientChannel>
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        /// <param name="packet"></param>
        public override PacketKey PKey
        {
            get
            {
                return PacketKey.InterInvoke;
            }
        }

        public override void Execute(UnityClientChannel client, Request packet)
        {
            base.Execute(client, packet);

            //注意，这里要获取，OESP 中 client来通信
            ClientChannel OESPClient = ServerController.Instance.OESPServerListener.ClientManager.GetClient(UserType.Student, client.User.DBid);
            if (OESPClient != null)
            {
                ResponsePacket = new Response(packet);
                OESPClient.Send(ResponsePacket);
            }
        }
    }

}
